package com.shuzixiangcun.controller.front;

import com.shuzixiangcun.entity.Fupinjiuzhu;

import com.shuzixiangcun.service.front.FupinjiuzhuFServiceImpl;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 扶贫救助表(Fupinjiuzhu)表控制层
 *
 * @author makejava
 * @since 2024-06-24 08:26:16
 */
@RestController
@RequestMapping("fupinjiuzhu")
public class FupinjiuzhuFController {
    /**
     * 服务对象
     */
    @Resource
    private FupinjiuzhuFServiceImpl fupinjiuzhuService;

    /**
     * 分页查询
     *
     * @param fupinjiuzhu 筛选条件
     * @param pageRequest 分页对象
     * @return 查询结果
     */


    /**
     * 通过主键查询单条数据
     *
     * @param id 主键
     * @return 单条数据
     */
    @GetMapping("{id}")
    public ResponseEntity<Fupinjiuzhu> queryById(@PathVariable("id") Object id) {
        return ResponseEntity.ok(this.fupinjiuzhuService.queryById(id));
    }

    /**
     * 新增数据
     *
     * @param fupinjiuzhu 实体
     * @return 新增结果
     */
    @PostMapping
    public ResponseEntity<Fupinjiuzhu> add(Fupinjiuzhu fupinjiuzhu) {
        return ResponseEntity.ok(this.fupinjiuzhuService.insert(fupinjiuzhu));
    }

    /**
     * 编辑数据
     *
     * @param fupinjiuzhu 实体
     * @return 编辑结果
     */
    @PutMapping
    public ResponseEntity<Fupinjiuzhu> edit(Fupinjiuzhu fupinjiuzhu) {
        return ResponseEntity.ok(this.fupinjiuzhuService.update(fupinjiuzhu));
    }

    /**
     * 删除数据
     *
     * @param id 主键
     * @return 删除是否成功
     */
    @DeleteMapping
    public ResponseEntity<Boolean> deleteById(Object id) {
        return ResponseEntity.ok(this.fupinjiuzhuService.deleteById(id));
    }

}

